# coding=utf-8

from selenium.common.exceptions import NoSuchElementException
from src.newselenium import Driver
from src.newselenium.by import By

class TestCaseMore(object):

    def checkElement(self, driver, by=By.ID, value=None):
        if isinstance(driver, Driver):
            try:
                return driver.getelement(by=by, value=value)
            except NoSuchElementException:
                self.assertTrue(False, "未找到该元素，%s" % ("方式：" + str(by) + "值：" + str(value)))
        else:
            try:
                return driver.find_element(*loc)
            except NoSuchElementException:
                self.assertTrue(False, "未找到该元素，%s" % ("方式：" + str(by) + "值：" + str(value)))